package com.sg.dto.integration.calc;

import com.sg.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @desc TargetBelongCycleDto
 * @使用场景
 */
@Data
public class TargetBelongCycleDto extends BaseDto implements Serializable {

    /**
     * 上一归属周期ID
     */
    @ApiModelProperty("上一归属周期ID")
    private String previousCycleId;

    /**
     * 归属周期ID
     */
    @NotNull(message = "归属周期ID不能为空")
    @ApiModelProperty("归属周期ID")
    private String cycleId;

    /**
     * 周期开始时间
     */
    @NotNull(message = "周期开始时间不能为空")
    @ApiModelProperty("周期开始时间")
    private Date cycleStartTime;

    /**
     * 周期结束时间
     */
    @NotNull(message = "周期结束时间不能为空")
    @ApiModelProperty("周期结束时间")
    private Date cycleEndTime;

    /**
     * 周期类型标识
     */
    @NotNull(message = "周期类型标识不能为空")
    @ApiModelProperty("周期类型标识")
    private String cycleTypeCode;

    /**
     * 是否末级周期 TRUE:是 FALSE:否
     */
    @NotNull(message = "是否末级周期不能为空")
    @ApiModelProperty("是否末级周期")
    private String isLastCycle;

    /**
     * 末级周期计算模型ID
     */
    @ApiModelProperty("末级周期计算模型ID")
    private String lastCycleCalcModelId;

    /**
     * 过程中间周期计算模型ID
     */
    @ApiModelProperty("过程中间周期计算模型ID")
    private String processCycleCalcModelId;

    /**
     * 子周期计算模型ID
     */
    @ApiModelProperty("子周期计算模型ID")
    private String subCycleCalcModelId;

    /**
     * 中期计算模型ID
     */
    @ApiModelProperty("中期计算模型ID")
    private String midCycleCalcModelId;

    /**
     * 父周期计算模型ID
     */
    @ApiModelProperty("父周期计算模型ID")
    private String parentCycleCalcModelId;

    /**
     * 归属内容表主键ID
     */
    @NotNull(message = "归属内容表主键ID不能为空")
    @ApiModelProperty("归属内容表主键ID")
    private String entityId;

    /**
     * 冗余评价模板ID
     */
    @NotNull(message = "冗余评价模板ID不能为空")
    @ApiModelProperty("冗余评价模板ID")
    private String evaluationTemplateId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        TargetBelongCycleDto that = (TargetBelongCycleDto) o;
        return (
                previousCycleId == that.previousCycleId &&
                        cycleId == that.cycleId &&
                        cycleStartTime == that.cycleStartTime &&
                        cycleEndTime == that.cycleEndTime &&
                        cycleTypeCode == that.cycleTypeCode &&
                        isLastCycle == that.isLastCycle &&
                        lastCycleCalcModelId == that.lastCycleCalcModelId &&
                        processCycleCalcModelId == that.processCycleCalcModelId &&
                        subCycleCalcModelId == that.subCycleCalcModelId &&
                        midCycleCalcModelId == that.midCycleCalcModelId &&
                        parentCycleCalcModelId == that.parentCycleCalcModelId &&
                        entityId == that.entityId &&
                        evaluationTemplateId == that.evaluationTemplateId
        );
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                super.hashCode(),
                previousCycleId,
                cycleId,
                cycleStartTime,
                cycleEndTime,
                cycleTypeCode,
                isLastCycle,
                lastCycleCalcModelId,
                processCycleCalcModelId,
                subCycleCalcModelId,
                midCycleCalcModelId,
                parentCycleCalcModelId,
                entityId,
                evaluationTemplateId
        );
    }

}
